<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/12/7
 * Time: 11:09
 */
//设置运bai行时间:永不超时
set_time_limit (0);
//开启缓冲du
ob_implicit_flush ();
//IP地址
$ip = "127.0.0.1";
//监听端口
$port = 8800;
//创建zhisocket
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if (!$socket){
    die("创建socket失败dao！zhuan").socket_strerror(socket_last_error());
}
//绑定shusocket
$bind = socket_bind ($socket, $ip, $port);
if (!$bind){
    die("绑定.socket失败！").socket_strerror ($bind);
}
//监听socket
$listen = socket_listen ($socket);
if (!$listen){
    die("监听失败！").socket_strerror ($listen);
}
echo "{$port}端口监听成功!";